home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
MATOPS.ZIP
/
SCMA.FOR
< prev
next >
Wrap
Text File
|
1985-11-29
|
2KB
|
63 lines
C
C ..................................................................
C
C SUBROUTINE SCMA
C
C PURPOSE
C MULTIPLY COLUMN OF MATRIX BY A SCALAR AND ADD TO ANOTHER
C COLUMN OF THE SAME MATRIX
C
C USAGE
C CALL SCMA(A,C,N,LA,LB)
C
C DESCRIPTION OF PARAMETERS
C A - NAME OF MATRIX
C C - SCALAR
C N - NUMBER OF ROWS IN A
C LA - COLUMN IN A TO BE MULTIPLIED BY SCALAR
C LB - COLUMN IN A TO WHICH PRODUCT IS ADDED
C IF 0 IS SPECIFIED, PRODUCT REPLACES ELEMENTS IN LA
C
C REMARKS
C MATRIX A MUST BE A GENERAL MATRIX
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C EACH ELEMENT OF COLUMN LA IS MULTIPLIED BY SCALAR C AND THE
C PRODUCT IS ADDED TO THE CORRESPONDING ELEMENT OF COLUMN LB.
C COLUMN LA REMAINS UNAFFECTED BY THE OPERATION.
C IF PARAMETER LB CONTAINS ZERO, MULTIPLICATION BY THE SCALAR
C IS PERFORMED AND THE PRODUCT REPLACES ELEMENTS IN LA.
C
C ..................................................................
C
SUBROUTINE SCMA(A,C,N,LA,LB)
DIMENSION A(1)
C
C LOCATE STARTING POINT OF BOTH COLUMNS
C
ILA=N*(LA-1)
ILB=N*(LB-1)
C
DO 3 I=1,N
ILA=ILA+1
ILB=ILB+1
C
C CHECK LB FOR ZERO
C
IF(LB) 1,2,1
C
C IF NOT MULTIPLY BY CONSTANT AND ADD TO SECOND COLUMN
C
1 A(ILB)=A(ILA)*C+A(ILB)
GO TO 3
C
C OTHERWISE, MULTIPLY COLUMN BY CONSTANT
C
2 A(ILA)=A(ILA)*C
3 CONTINUE
RETURN
END